var gulp = require('gulp');
var postcss = require('gulp-postcss');
var px2rem = require('postcss-px2rem');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;

gulp.task('px2rem', function () {
    var processors = [px2rem({ remUnit: 75 })];
    return gulp.src('./Public/newKapaqi/*.css')
        .pipe(postcss(processors))
        .pipe(gulp.dest('./Public/newKapaqi/css'))
        .pipe(reload({
            stream: true
        }));
});

// 静态服务器 + 监听 scss/html 文件
gulp.task('serve', function () {
    browserSync.init({
        server: "./"
    });
    gulp.watch('./Public/newKapaqi/*.css', ['px2rem']);
    gulp.watch("./html/newKapaqi/*.html").on('change', reload);
});

gulp.task('default', ['serve']);